﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Provenance.Infra.Migrations
{
    public partial class _20241217 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "ApiPermissions",
                columns: table => new
                {
                    ApiPermissionId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ApiPath = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    ApiName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    CreateOperatorId = table.Column<int>(type: "int", nullable: false),
                    CreateOperatorName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    ModifyOperatorId = table.Column<int>(type: "int", nullable: true),
                    ModifyOperatorName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ModifyDate = table.Column<DateTime>(type: "datetime2", nullable: true),
                    DeleteOperatorId = table.Column<int>(type: "int", nullable: true),
                    DeleteOperatorName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DeleteDate = table.Column<DateTime>(type: "datetime2", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ApiPermissions", x => x.ApiPermissionId);
                });

            migrationBuilder.CreateTable(
                name: "RoleApiPermissions",
                columns: table => new
                {
                    RoleApiPermissionId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    RoleId = table.Column<int>(type: "int", nullable: false),
                    ApiPermissionId = table.Column<int>(type: "int", nullable: false),
                    CreateOperatorId = table.Column<int>(type: "int", nullable: false),
                    CreateOperatorName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    ModifyOperatorId = table.Column<int>(type: "int", nullable: true),
                    ModifyOperatorName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ModifyDate = table.Column<DateTime>(type: "datetime2", nullable: true),
                    DeleteOperatorId = table.Column<int>(type: "int", nullable: true),
                    DeleteOperatorName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DeleteDate = table.Column<DateTime>(type: "datetime2", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RoleApiPermissions", x => x.RoleApiPermissionId);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "ApiPermissions");

            migrationBuilder.DropTable(
                name: "RoleApiPermissions");
        }
    }
}
